package mammuthus.master

import akka.actor.Actor
import mammuthus.protocal.{ExecuteDownloadCommandResponse, RegisterAgentSuccess, RegisterAgent}
import net.csdn.common.logging.Loggers
import akka.remote.{DisassociatedEvent, RemotingLifecycleEvent}

/**
 * 3/24/15 WilliamZhu(allwefantasy@gmail.com)
 */
class MasterActor(akkaMaster: Master) extends Actor {
  val logger = Loggers.getLogger(getClass)


  def receive: Receive = {
    case RegisterAgent(hostName, slaveActorRef, slaveInfo) =>
      akkaMaster.slaves(hostName) = (slaveActorRef, slaveInfo)
      slaveActorRef ! RegisterAgentSuccess
    case ExecuteDownloadCommandResponse(success, msg, request) =>
      logger.info(request.url + "=>" + request.filePath + "=>" + success + "=>" + msg)

  }




}
